package cc.xsubj.trading.messages;

import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.TrueTypeFont;

import cc.xsubj.trading.game.TradingGameMain;

public class SharpText
{
    private static Image textImage;
    private static Graphics textGraphics;
    private static TrueTypeFont textFont;
    
    static {
        try {
            textFont = new TrueTypeFont(new java.awt.Font("SansSerif", java.awt.Font.PLAIN, 10), false);
            textImage = new Image(TradingGameMain.SCREEN_WIDTH, 40);
            textGraphics = textImage.getGraphics();
        } catch (SlickException e) {
            e.printStackTrace();
        }
    }

    public static void drawString(String text, Graphics g, float x, float y)
    {
        textGraphics.clear();
        textGraphics.setColor(Color.black);
        textGraphics.setFont(textFont);
        textGraphics.drawString(text, 0, 0);
        g.drawImage(textImage, x, y);
    }
}
